import json
import requests
# from utils.baidu_ai import settings


import settings


def get_answer(question):
    url = 'https://api.ownthink.com/bot'
    data = {
        "spoken": question,
        "appid": settings.APPID,
        "userid": "user"
    }
    sess = requests.post(url=url, data=data)

    answer = sess.text

    answer = json.loads(answer)

    # print(answer)
    return answer['message'], answer['data']['info']['text']

# question = "你好"
# message, text = get_answer(question)
# print(message)

# print('问题：%s' % question)
# print("回答》》》%s" % text)
